//
//  HJBlogUser.swift
//  Micro-blog Sina
//
//  Created by admin on 16/3/25.
//  Copyright © 2016年 admin. All rights reserved.
//

import UIKit

class HJBlogUser: NSObject {
    
    var id: Int64 = 0
    var profile_image_url: String?
    var screen_name: String?
    var mbrank: Int = 0 {
        didSet {
            if mbrank > 0 && mbrank <= 6 {
                mbrankImage = UIImage(named: "common_icon_membership_level\(mbrank)")
            }else {
                mbrankImage = nil
            }
        }
    }
    
    var mbrankImage: UIImage?
    /// verified_type 没有认证:-1   认证用户:0  企业认证:2,3,5  达人:220
    var verified_type: Int = -1 {
        didSet {
            var image: UIImage?
            switch verified_type {
            case 0:
                image = UIImage(named: "avatar_vip")
            case 2,3,5:
                image = UIImage(named: "avatar_enterprise_vip")
            case 220:
                image = UIImage(named: "avatar_grassroot")
            default:
                image = nil
            }
            verifiedViewImage = image
        }
    }
    
    var verifiedViewImage: UIImage?
    init(dict: [String: AnyObject]) {
        super.init()
        setValuesForKeysWithDictionary(dict)
    }
    
    override func setValue(value: AnyObject?, forUndefinedKey key: String) {}
    
    override var description: String {
        let keys = ["id", "profile_image_url", "screen_name", "mbrank", "verified_type"]
        return "\n\t微博用户模型 :\(dictionaryWithValuesForKeys(keys).description)"
    }
}
